package com.boot2523.myredis.r2;

import com.boot2523.bean.Admin;
import redis.clients.jedis.Jedis;

import java.util.HashMap;

public class R2 {
    public static void main(String[] args) {
        Jedis j=new Jedis();
        //将管理员的数据存入hash中
        Admin a=new Admin();
        a.setAid(1);
        a.setAname("tom");
        a.setApwd("tiger");
        HashMap<String,String> data=new HashMap<>();
        data.put("aid",String.valueOf(a.getAid()));
        data.put("aname",a.getAname());
        //取
        j.hset("ad",data);
        //取
        System.out.println(j.hgetAll("ad"));
    }
}
